﻿using Microsoft.Extensions.Caching.Memory;
using System;
using System.Threading;

namespace MemoryCacheProj
{
    class Program
    {
        static void Main(string[] args)
        {

            MemoryCache cache = new MemoryCache(new MemoryCacheOptions()
            {
                SizeLimit = 100

            });

            for (int j = 0; j < 1000; j++)
            {
                cache.Set(j.ToString(), j, new MemoryCacheEntryOptions()
                {
                    Size = j.ToString().Length
                });
            }

            for (int k = 0; k < cache.Count; k++)
            {
                var val = cache.Get(k.ToString());
                Console.WriteLine(val);
            }


            



            Console.Read();
        }
    }
}
